<%@ taglib uri="/WEB-INF/vectrics.tld" prefix="vectrics"%>
<%@ taglib uri="/WEB-INF/hexacta.tld" prefix="hexacta"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>

<%@page import="org.vectrics.hibernate.ThreadProperties"%>

<%
    String userId = request.getParameter("userId");

    if ((userId == null) || (userId.trim().length() == 0)) {
        userId = (String) request.getAttribute("userId");
    }
    if ((userId == null) || (userId.trim().length() == 0)) {
        userId = (String) request.getSession(true).getAttribute("userId");
    }
    if ((userId == null) || (userId.trim().length() == 0)) {
        userId = request.getParameter("id");
    }
    if ((userId == null) || (userId.trim().length() == 0)) {
        userId = request.getParameter("personId");
    }

    if ((userId == null) || (userId.trim().length() == 0)) {
        userId = (String) request.getAttribute("personId");
    }

    if ((userId != null) && (userId.equals("current"))) {
        userId = ThreadProperties.getPerson().getId().toString();
    }

    if ((userId == null) || (userId.trim().length() == 0)) {
        throw new RuntimeException("User ID is blank or null");
    }

    String companyId = ThreadProperties.getDomain().getPrimaryCompany().getId().toString();
%>

<table width="100%">
	<tr>
		<td valign="top"><hexacta:employeeHiringConditions
				personId="<%=userId%>" companyId="<%=companyId%>" /></td>
		<td valign="top" align="left">
			<table>
				<tr>
					<td>
						<form id="view_person" action="/hrs-intranet/admin/user/view.do"
							method="POST">
							<input type="hidden" name="userId" value="<%=userId%>"> <input
								type="hidden" name="personId" value="<%=userId%>">
							<vectrics:formButton elementId="view.person.btn"
								code="button.param" phraseCode="button.candidate.view.person"
								value="submit" name="submit" />
						</form></td>
				</tr>
				<tr>
					<td>
						<form
							action="/hrs-intranet/hrs2/EditHiringConditionsAction_editHiringConditions.action"
							method="POST">
							<input type="hidden" name="userId" value="<%=userId%>"> <input
								type="hidden" name="personId" value="<%=userId%>">
							<vectrics:formButton code="button.param"
								phraseCode="button.employee.hiringcondition.edit"
								elementId="employee.hiringcondition.edit.btn" value="submit"
								name="submit" permission="manage_employee_information" />
						</form></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
